const TerserPlugin = require("terser-webpack-plugin");
const { defineConfig } = require("@vue/cli-service");

//打包配置文件
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath: "./",
  outputDir: "dist",
  configureWebpack: (config) => {
    if (process.env.NODE_ENV === "production") {
      config.optimization = {
        ...config.optimization,
        minimizer: [
          new TerserPlugin({
            terserOptions: {
              compress: {
                warnings: false,
                drop_console: true, // 移除 console
                drop_debugger: true, // 移除 debugger
                pure_funcs: ["console.log", "console.error"], // 移除特定的函数
              },
            },
          }),
        ],
      };
    }
  },
});
